<template>
  <div>
    <div class="layout-box">
      <div class="layout-box-header">
        <i class="icon-layout-box-title" />下载（a标签下载）
      </div>
      <div class="layout-box-content">
        <el-button type="success" @click="download">下载</el-button>
      </div>
    </div>
    <div class="layout-box">
      <div class="layout-box-header">
        <i class="icon-layout-box-title" />下载（请求接口返回文件流）
      </div>
      <div class="layout-box-content">
        <el-button type="success" @click="downloadtwo">下载</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import { blobDownload } from '@/utils/download'
export default {
  data() {
    return {}
  },
  methods: {
    download() {
      var $a = document.createElement('a')
      $a.setAttribute('href', '/mock/yhscV1.0.docx')
      $a.setAttribute('download', '总局工作门户用户手册-v1.0.docx') // 需要加上后缀名
      document.body.appendChild($a)
      $a.click()
      document.body.removeChild($a)
    },
    downloadtwo() {
      blobDownload()
    }

  }
}
</script>
<style scoped>
</style>
